UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a1n9OMsKprEGOFX0Yx5g0Z7WgNth43eBN3md9IS8FCk='
WHERE
key_id = '7ce6f99b51b0248df38f23fbbd6f5f11a4e9d21ae03bc7fced7874e99e36a9cb'
AND (
token = 'a1n9OMsKprEGOFX0Yx5g0Z7WgNth43eBN3md9IS8FCk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)