UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ar6JxH3Mm2ukQeQolgKGNpzvZyMTBfj959UhTt9vg/k=' 
WHERE 
  key_id = 'b9a42df88563c37e370e30d7be11681b92045d15145efd75355ef6ab7591db38' 
  AND (
    token = 'ar6JxH3Mm2ukQeQolgKGNpzvZyMTBfj959UhTt9vg/k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047