UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oe9LfAmZEl5abJfMjFvHFYUZefvh47I/91eqqa0Aci0='
WHERE
key_id = 'deff81fbd38e068d879c3359e006d6da20c36b6e4046e21c735976c7d4bf08e4'
AND (
token = 'oe9LfAmZEl5abJfMjFvHFYUZefvh47I/91eqqa0Aci0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)