UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SXFt5e+jdcBol55o/PIWbNx/CMMzlh1TvvfpYrCVxE8='
WHERE
key_id = 'f670c01ba7237b6ca08e182962367250d99345876cc70ca69107f77f3d1fd8c2'
AND (
token = 'SXFt5e+jdcBol55o/PIWbNx/CMMzlh1TvvfpYrCVxE8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)