UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'avXy93YEMRLNbhtGW2dUEH+9bp4Boi2XrHofpTnm6PM='
WHERE
key_id = 'a7e249a28eeb4c091bab5ba828609a7e8de8540758556b485a13c54175d7dd69'
AND (
token = 'avXy93YEMRLNbhtGW2dUEH+9bp4Boi2XrHofpTnm6PM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)