UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TY8RdsdnJlQcwycBAat2U9DL32Ebz5z+dc/Z+cOqLtM='
WHERE
key_id = '4337aa37717c7e49bc06e0e09cd51c786c244b6181de369207d77b77854eccce'
AND (
token = 'TY8RdsdnJlQcwycBAat2U9DL32Ebz5z+dc/Z+cOqLtM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)