UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ovBcdLL+bef6M9yLfgRfsDtCS76jSvAb6B3knBL4MUw=' 
WHERE 
  key_id = '1cfc3de167ab758f45ca229153514ed8c160533fb76a4980e231c37d07220b05' 
  AND (
    token = 'ovBcdLL+bef6M9yLfgRfsDtCS76jSvAb6B3knBL4MUw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026