UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JPy/BoNC7rrfycz1l10c2fW4xHQbVUGqLul3DlpmTwo=' 
WHERE 
  key_id = 'a9e82572e545228d97130e045f3f802cd7cb97a4cc08503d28dbf408311f14ac' 
  AND (
    token = 'JPy/BoNC7rrfycz1l10c2fW4xHQbVUGqLul3DlpmTwo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039