UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xxTZvT5UfaETeovjgMVjEu34LHd4RhhNECS4Zx27q8I=' 
WHERE 
  key_id = '04df95ee076dd26b148a86029be6e4ee27b00f483d81fc98efc1d46255f2df67' 
  AND (
    token = 'xxTZvT5UfaETeovjgMVjEu34LHd4RhhNECS4Zx27q8I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037