UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9WCnyX4mavZA9zR2sUsNihET1C1bYE+vSd028wv7Myw=' 
WHERE 
  key_id = 'c7fe5ef517c9a0d8076fe93a8a2d77fd664929483c89ee276faacca5846f9d1b' 
  AND (
    token = '9WCnyX4mavZA9zR2sUsNihET1C1bYE+vSd028wv7Myw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025