UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nZAMKzlnmDLmrE2qL2NgDT8GMR4VBrTY35OSgtS/yDo='
WHERE
key_id = 'ec21cd65b636487c0dd8924a3b027f566f923893e6a6585557192dc2d976f446'
AND (
token = 'nZAMKzlnmDLmrE2qL2NgDT8GMR4VBrTY35OSgtS/yDo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)