UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qTRPetOr6337KFpvwthyxJ+YCTOsMLYj0QpPH2nvrfc='
WHERE
key_id = '4a74ca33028713395642651e4cf8343382a294be283a824d01cdf0c05d35a251'
AND (
token = 'qTRPetOr6337KFpvwthyxJ+YCTOsMLYj0QpPH2nvrfc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)