UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6CqEGTTxow/Y4c1WTGvdVDkc367gLoKkE7ZITYbCz4A=' 
WHERE 
  key_id = '65bd58dfd53731e445b42e5808929e364b37ec32798148863b11cffb26434a89' 
  AND (
    token = '6CqEGTTxow/Y4c1WTGvdVDkc367gLoKkE7ZITYbCz4A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040