UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e2kiWHtMa4XZO+WavdxCYqMpswH6GtyYVOzDqs56MY4='
WHERE
key_id = 'eaaa67bf8b13cda11ad5d51be30684561b66dc90b2bc112356ccf6b0edabe0ee'
AND (
token = 'e2kiWHtMa4XZO+WavdxCYqMpswH6GtyYVOzDqs56MY4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)