UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QHf//eWanWvEPQ7HsYlif+Ig2O/zH9To0HwNj5Lv8L8=' 
WHERE 
  key_id = '9fca2ae5368e1e777861a657f62bb6de5b8f037edb3995ab7d5f3a1ffcfe46d5' 
  AND (
    token = 'QHf//eWanWvEPQ7HsYlif+Ig2O/zH9To0HwNj5Lv8L8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028