UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RqKg34UZvtbZuzriGH1cjMHzW7KaTXgmTLV30xa9vaI='
WHERE
key_id = '50dbd9f1498a3b0a63a24e5c4a81731d5ce01024d58dfe14a195cd57a6e1dc87'
AND (
token = 'RqKg34UZvtbZuzriGH1cjMHzW7KaTXgmTLV30xa9vaI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)