UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gq0blVY8HT2RkhlOOsi0cnHwjPhohEiNQUM+XtPa1xw=' 
WHERE 
  key_id = '5a680cb8f292aa76e3a45ebffb518f1c5373ad4c5ab09dc88a3e25832c86d36a' 
  AND (
    token = 'gq0blVY8HT2RkhlOOsi0cnHwjPhohEiNQUM+XtPa1xw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034