UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CGsS6JbF0bNPfoIfU78+8AA6Xz0IpHADqzYGfqoR9D8='
WHERE
key_id = '401bea515bd50352b2a7de082a2286ab04fa23633f8c25a1f12853bd33c4d8bd'
AND (
token = 'CGsS6JbF0bNPfoIfU78+8AA6Xz0IpHADqzYGfqoR9D8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)