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