UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k1nV0p5ybQdge0i0lMYC4IAbzccF7m+uU963U3wfLjk=' 
WHERE 
  key_id = '429a71db05320d91199c5f898852e4e2d42ab9aa24bf0f218407404fb1c689dc' 
  AND (
    token = 'k1nV0p5ybQdge0i0lMYC4IAbzccF7m+uU963U3wfLjk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029