UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '74cnuSZ1S1R58eMaJWZANot3szEMKqO7QscV2gYqklw=' 
WHERE 
  key_id = 'f9f666f460b1e1e9973f21734316d3082b35df024418ddc261d9bf2a380913b0' 
  AND (
    token = '74cnuSZ1S1R58eMaJWZANot3szEMKqO7QscV2gYqklw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028