UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DiqKq2z98kuZJb25Zeu1Jmq5/m1Ps8WJY3oGXpLCf3c=' 
WHERE 
  key_id = '1a4e529f87e3504cc29b5b3bee416ca8b335f2445f526ab629d258b17423acc5' 
  AND (
    token = 'DiqKq2z98kuZJb25Zeu1Jmq5/m1Ps8WJY3oGXpLCf3c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00213