UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J1MJKWyFeaTrKhz/YaWUfwDq5ppzu+CJJzUFwx12I+c=' 
WHERE 
  key_id = '1f963186c44af65d6dd3c0cffa471526df672154d131fccc2b00dcff8fb78968' 
  AND (
    token = 'J1MJKWyFeaTrKhz/YaWUfwDq5ppzu+CJJzUFwx12I+c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037