UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YdplriKBZr2l0CgQoPde4yuLLvMQsHTG2f1+nah2AmI='
WHERE
key_id = 'a12da8e88111ef3cc9b8f0d4bd1e37e6162931686869e5673b6bfb579aaa2876'
AND (
token = 'YdplriKBZr2l0CgQoPde4yuLLvMQsHTG2f1+nah2AmI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)