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

Query time 0.00024