UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KsL5lHh2K9mercMelWJcA41NgHBqtu7an7TeAb+MeQk='
WHERE
key_id = '1bbeea6d54da05185d5650b80b22fecf890539c30d9ab1b0b7d7b0ff4dcba8e1'
AND (
token = 'KsL5lHh2K9mercMelWJcA41NgHBqtu7an7TeAb+MeQk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)