UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ot6lsNCGbYdFOST1MfTLdkuMpee4nMuQKcY74oekbvs='
WHERE
key_id = 'b95b599554ed07132338c2ea25f89c472e81831c41dc89c88b1dfcbe68bb5185'
AND (
token = 'ot6lsNCGbYdFOST1MfTLdkuMpee4nMuQKcY74oekbvs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)