UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xqomflRTLQYDpTCdAmDuHBCof+bpVbs+zMojqda+9Cg='
WHERE
key_id = '85780be8ee9d0dad730d1a45e809cd248f4362d452e03976c0c9565c1418b28b'
AND (
token = 'xqomflRTLQYDpTCdAmDuHBCof+bpVbs+zMojqda+9Cg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)