UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YZ9pT/IKEnG3c+F9luS+lwq1pX/Hl14zuZrYbtsC1io=' 
WHERE 
  key_id = '8d6700fb86f26188dffd5f5880c711426bf8aba8f82fcd5136cade917da75e62' 
  AND (
    token = 'YZ9pT/IKEnG3c+F9luS+lwq1pX/Hl14zuZrYbtsC1io=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051