UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '08v845aHVfqpeE7tRTyG0frqdY+2blUb6TPqbpLlUEY=' 
WHERE 
  key_id = '376208370ff55af3d572bf91c106173d375abc66dbac4784c58570dbdcae6e0b' 
  AND (
    token = '08v845aHVfqpeE7tRTyG0frqdY+2blUb6TPqbpLlUEY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047