UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j4CHrWKkmRuLvj5GxlCONxBOfQDzOkX3GspNFq9LOqM='
WHERE
key_id = '57fa5213cf683895df250634ed78c8b8732db649cd4b4caeff2b5d573705d4ad'
AND (
token = 'j4CHrWKkmRuLvj5GxlCONxBOfQDzOkX3GspNFq9LOqM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)