UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gyj/4+KSMRE5WjfOuNdVgte7Un/ix5X7sXAnvAcf508=' 
WHERE 
  key_id = 'b0e13305a9ca4cf01e56951668736a07b4820ea27916891138a9bc5f4eaa9c09' 
  AND (
    token = 'gyj/4+KSMRE5WjfOuNdVgte7Un/ix5X7sXAnvAcf508=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030