UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A7VDtS/Pbs1vb71cPn+FTEEJ2hYjInVsnB0KoennqUM='
WHERE
key_id = 'bb54755cc55c2b36db1baaa4f402c8bcebc7718c406889ebc5ad42ac1b39b32f'
AND (
token = 'A7VDtS/Pbs1vb71cPn+FTEEJ2hYjInVsnB0KoennqUM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)