UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kIfiSWRAOKds4DMpWnh9Mdgf8s8Z6VB0Xhjh2JZQ63I='
WHERE
key_id = 'd38065eba59872e031d1b461126bf6f9d537d5af004d1dbfee65309429173ccd'
AND (
token = 'kIfiSWRAOKds4DMpWnh9Mdgf8s8Z6VB0Xhjh2JZQ63I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)