UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8PvAVfK188Nu7b1ODgoQh2Am6PekGdocgbER6iuNYo4='
WHERE
key_id = '53ce3207fa9aa56b08d6965578188d78ae48e715b1418571e68dcd18afe37295'
AND (
token = '8PvAVfK188Nu7b1ODgoQh2Am6PekGdocgbER6iuNYo4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)