UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p29WGOzqaikaAt19AJWbecBAMmGrmZuL62DTvcR8ABo='
WHERE
key_id = '6b211c9f502f0bad8288b02e49f76a7b6c8cbe220883876955d1254ac7fc76e3'
AND (
token = 'p29WGOzqaikaAt19AJWbecBAMmGrmZuL62DTvcR8ABo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)