UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TM2QxmYSvJfHbmn0UsLOuFj+S0Ja3Mx8MxXA9apN1zk='
WHERE
key_id = 'bce2a299f571ad549f7c42c93bc7b309ac70a4b995a0fed305fede51cad19846'
AND (
token = 'TM2QxmYSvJfHbmn0UsLOuFj+S0Ja3Mx8MxXA9apN1zk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)