UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BIZZFYt0CDtmB6tVI0wjRNz9h2+k/Agc4fJ0Fw8Em2Q=' 
WHERE 
  key_id = 'd316930eba2349b0aabc5b5db91b9321c0f48652065dd2c8da90d4a31508f522' 
  AND (
    token = 'BIZZFYt0CDtmB6tVI0wjRNz9h2+k/Agc4fJ0Fw8Em2Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00069