UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aveoynVZm0UOTDwDB6kLy9nxUJuleHbhu5Op6Qd2vzE=' 
WHERE 
  key_id = '2595d83acf0d4ed4010ea29e3e38cc5bb4713f60fb424d45eec29d97309d72af' 
  AND (
    token = 'aveoynVZm0UOTDwDB6kLy9nxUJuleHbhu5Op6Qd2vzE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017